/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.figures;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;

import edu.pku.notation.runtime.draw2d.RectangleFigure;
import edu.pku.notation.runtime.draw2d.TextFigure;
import edu.pku.notation.runtime.layout.FlowLayout;
import edu.pku.notation.runtime.layout.VectorGraphLayout;

/**
 * @generated
 *
 */
public class InterfaceFigure extends CommonFigure {
	public static final org.eclipse.swt.graphics.Color INTERFACE_COLOR = new Color(Display.getDefault(),200,186,62);
	public IFigure root = null;
	
	private TextFigure text31754 = null;
	
	private TextFigure text31760 = null;
	
	private TextFigure text31762 = null;
	
	public InterfaceFigure(){
		
		IFigure f = null;
		IFigure parent = null;
		XYLayout layout = new XYLayout();
		setLayoutManager(layout);
		List parentList = new ArrayList<IFigure>();
		parentList.add(this);
		
		f = new RectangleFigure();
		parent = (IFigure)parentList.get(0);
		parent.add(f);
		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 0, 0, 0));
		f.setBounds(new Rectangle(78, 51, 400, 270));
		f.setLayoutManager(new VectorGraphLayout());
		parentList.add(f);
		
		f = new TextFigure();
		text31754 = (TextFigure)f;
		((TextFigure)f).setText("Text");
		((TextFigure)f).setAlignment(1);
		parent = (IFigure)parentList.get(1);
		parent.add(f);
		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 0, 0, 0));
		f.setBounds(new Rectangle(78, 51, 400, 52));
		
		f.setLayoutManager(new FlowLayout());
		
		((VectorGraphLayout)parent.getLayoutManager()).setConstraint(parent, f);
		parentList.add(f);
		
		f = new RectangleFigure();
		parent = (IFigure)parentList.get(1);
		parent.add(f);
		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 0, 0, 0));
		f.setBounds(new Rectangle(78, 101, 400, 101));
		
		f.setLayoutManager(new FlowLayout());
		
		((VectorGraphLayout)parent.getLayoutManager()).setConstraint(parent, f);
		parentList.add(f);
		
		f = new RectangleFigure();
		parent = (IFigure)parentList.get(1);
		parent.add(f);
		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setBounds(new Rectangle(81, 203, 395, 117));
		
		f.setLayoutManager(new FlowLayout());
		
		((VectorGraphLayout)parent.getLayoutManager()).setConstraint(parent, f);
		parentList.add(f);
		
		f = new TextFigure();
		text31760 = (TextFigure)f;
		((TextFigure)f).setText("Text");
		((TextFigure)f).setAlignment(1);
		parent = (IFigure)parentList.get(3);
		parent.add(f);
		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 0, 0, 0));
		f.setBounds(new Rectangle(78, 101, 400, 94));
		
		f.setLayoutManager(new FlowLayout());
		
		((FlowLayout)parent.getLayoutManager()).setConstraint(parent,f,-1,94,0);
		parentList.add(f);
		
		f = new TextFigure();
		text31762 = (TextFigure)f;
		((TextFigure)f).setText("Text");
		((TextFigure)f).setAlignment(1);
		parent = (IFigure)parentList.get(4);
		parent.add(f);
		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 255, 255, 255));
		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 0, 0, 0));
		f.setBounds(new Rectangle(81, 203, 395, 117));
		
		f.setLayoutManager(new FlowLayout());
		
		((FlowLayout)parent.getLayoutManager()).setConstraint(parent,f,-1,-1,0);
		parentList.add(f);
		
		if(parentList.size()>1)
		{
			root = (IFigure)parentList.get(1);
			root.setBounds(new Rectangle(0,0,root.getBounds().width, root.getBounds().height));
		}
		
		
	}
	
	public TextFigure getText31754() {
		return text31754;
	}
	
	public TextFigure getText31760() {
		return text31760;
	}
	
	public TextFigure getText31762() {
		return text31762;
	}
	
	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
		if (root != null)
			root.setSize(rect.width, rect.height);
	}
	protected void paintShadow(Graphics g) {
		// TODO: draw the figure's own shadow here
	}
}
